package me.yuzho.study.concurrency;

/** volatile 并不能对递增不是原子性操作这一事实产生影响 
 * @author yzhou-citrix
 *
 */
public class SerialNumberGenerator {
    private static volatile int serialNumber = 0;
    
    public synchronized static int nextSerialNumber() {
        return serialNumber++; // not thread-safe
    }

}
